using Abp.Timing.Timezone;
using L._52ABP.Application.Dtos;
using System.Collections.Generic;
using Yozeev.BusinessLogic.Dtos;
using Yozeev.DataExporting.Excel.Epplus;
using Yozeev.DataFileObjects.DataTempCache;

namespace Yozeev.UserManagement.Users.Exporting
{
    public class CustomListExcelExporter : EpplusExcelExporterBase, ICustomListExcelExporter
    {

        private readonly ITimeZoneConverter _timeZoneConverter;

        public CustomListExcelExporter(IDataTempFileCacheManager dataTempFileCacheManager, ITimeZoneConverter timeZoneConverter) : base(
            dataTempFileCacheManager)
        {
            _timeZoneConverter = timeZoneConverter;
        }

        public FileDto ExportToExcel(List<CustomerListDto> customerListDtos)
        {
            var excel =
                CreateExcelPackage("CustomerList.xlsx", excelpackage =>
                {
                    var sheet = excelpackage.Workbook.Worksheets.Add(L("Customs"));
                    sheet.OutLineApplyStyle = true;
                    AddHeader(sheet,
                        L("CustomerName"),
                        L("Mobile"),
                        L("LoginPwd"),
                        L("Sex"),
                        L("Country"),
                        L("Province"),
                        L("City"),
                        L("Country"),
                        L("CertificatesNum"),
                        L("VerifiableType"),
                        L("Job"),
                        L("OpenID"),
                        L("Photo"),
                        L("DateOfBirth"),
                        L("CreateId"),
                        L("CreationTime"));


                    AddObject(sheet, 2, customerListDtos,
                        ex => ex.CustomerName,
                        ex => ex.Mobile,
                        ex => ex.Sex,
                        ex => ex.Country,
                        ex => ex.Province,
                        ex=>ex.City,
                        ex => ex.County,
                        ex => ex.CertificatesNum,
                        ex => ex.VerifiableType,
                        ex => ex.Job,
                        ex => ex.OpenID,
                        ex => ex.Photo,
                        ex => ex.DateOfBirth,
                        ex => AbpSession.UserId,
                        ex => ex.CreationTime
                       );

                   

                    //var createTimeColumn = sheet.Column(3);
                    //createTimeColumn.Style.Numberformat.Format = "yyyy-mm-dd";
                });



            return excel;
        }
    }
}